]> dgit.raspbian.org Git - ostree.git/commit
lib/commit: Fix min-free-space accounting for reflinked content objects
authorJonathan Lebon <jlebon@redhat.com>
Fri, 24 Jul 2026 17:02:58 +0000 (13:02 -0400)
committerJonathan Lebon <jonathan@jlebon.com>
Fri, 24 Jul 2026 19:21:42 +0000 (15:21 -0400)
commit07547d29e05a7e6c321a8cc7101d0d7fd361f5a6
treedc685b657cd6b06eb82d106f0f2854ae4de18fd9
parent827c0f8f0bcf480613003827dd2b63068382b338
lib/commit: Fix min-free-space accounting for reflinked content objects

When writing a content object,
create_regular_tmpfile_linkable_with_content() opportunistically tries
FICLONE to reflink data from the input fd. The reflinked file shares its
data blocks via copy-on-write, so the actual disk cost is just metadata.

However, the min-free-space accounting in write_content_object()
reserves the full file size in max_blocks upfront and never credits it
back after a successful reflink. Over many files this causes max_blocks
to diverge significantly from actual free space.

Propagate the reflink status from
create_regular_tmpfile_linkable_with_content back to
write_content_object so it can credit back the reserved blocks,
following the same pattern used for duplicate objects in 16e537cb
("lib/commit: Fix min-free-space accounting for duplicate content
objects").

This should fix the CI issues in
https://github.com/coreos/fedora-coreos-config/pull/4265.

Heavily AI-guided investigation and resolution and red-green testing.

Assisted-by: AI
src/libostree/ostree-repo-commit.c
tests/test-repo.c